package com.qijian.maindata.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qijian.common.annotation.Excel;
import com.qijian.common.core.domain.BaseEntity;
import com.qijian.common.core.domain.entity.SysUser;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.util.List;

import static com.baomidou.mybatisplus.annotation.FieldStrategy.IGNORED;

/**
 * 工厂对象 fm_factory
 *
 * @author ruoyi
 * @date 2021-08-19
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString
@TableName("fm_factory")
public class Factory extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 唯一id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(type = IdType.INPUT)
    private Long id;

    /**
     * 编码
     */
    @Excel(name = "编码" ,sort = 1)
    private String code;

    /**
     * 名称
     */
    @Excel(name = "名称",sort = 2)
    private String name;

    /**
     * 类型
     */
    @Excel(name = "类型",sort = 3)
    private String type;

    @ApiModelProperty("祖级列表")
    @TableField(insertStrategy = IGNORED, updateStrategy = IGNORED)
    private String ancestors;

    /**
     * 父级id
     */
    @Excel(name = "父级id",sort = 4)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;

    /**
     * 名称
     */
    @Excel(name = "父级名称",sort = 5)
    private String parentName;

    /**
     * 顶级id
     */
    @Excel(name = "顶级id",sort = 6)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long topId;

    /**
     * 负责人id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long chargeUserId;

    @TableField(exist = false)
    private SysUser chargeUser;

    /**
     * 是否禁用
     */
    @Excel(name = "是否禁用",sort = 8)
    private Boolean isDisabled;

    @Excel(name = "工作时间",sort = 9)
    private String workTime;

    /**
     * 顺序
     */
    @Excel(name = "顺序",sort = 10)
    @ApiModelProperty(value = "顺序")
    private Long sort;

    @TableField(exist = false)
    private List<FactoryUser> users;
}
